#include <stdio.h>
#include "logo_lib.h"
#include "testexec.h"

static void print_usage (char* exefile);


CExec g_test_exec;

int main (int argc, char** argv)
{
 //  token_t  token;
   FILE* src_file;

   if (argc != 2) {
      print_usage (argv[0]);
      return 1;
   }

   src_file = fopen (argv[1], "rt");
   if (!src_file) {
      printf ("Source file %s doesn't exist.\n", argv[1]);
      return 1;
   }

   set_exec_obj (&g_test_exec);
   start_scanning (src_file);

   node_handler_t t = parse ();

   printf ("=================================================\n");
   if (t) {
      printf ("R  "); /* root node */
      print_parse_tree (t);
   } else {
      printf ("Empty parse tree.\n");
   }

   fclose (src_file);
   if (!check_syntax_error()) {
      interpret (t);
   }
   return 0;
}

static void print_usage (char* exefile)
{
   printf ("Usage: %s logo_src_file\n", exefile);
}



